using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(EnemyState))]
public class Enemy_Skeleton : Enemy
{
    public SkeletonIdleState skeletonIdleState { get; private set; }
    public SkeletonMoveState skeletonMoveState { get; private set; }
    public SkeletonBattleState skeletonBattleState { get; private set; }
    public SkeletonAttackState skeletonAttackState { get; private set; }
    public SkeletonHitState skeletonHitState { get; private set; }
    public SkeletonDieState skeletonDieState { get; private set; }
    protected override void Awake()
    {
        base.Awake();
        skeletonIdleState = new SkeletonIdleState(this, enemyStateMachine, "Idle", this);
        skeletonMoveState = new SkeletonMoveState(this, enemyStateMachine, "Move", this);
        skeletonBattleState = new SkeletonBattleState(this, enemyStateMachine, "Move", this);
        skeletonAttackState = new SkeletonAttackState(this, enemyStateMachine, "Attack", this);
        skeletonHitState = new SkeletonHitState(this, enemyStateMachine, "Hit", this);
        skeletonDieState = new SkeletonDieState(this, enemyStateMachine, "Die", this);
    }
    protected override void Update()
    {
        base.Update();
    }
    protected override void Start()
    {
        base.Start();
        itemDrop = GetComponent<ItemDrop>();
        enemyStateMachine.Initialize(skeletonIdleState);
    }
    public override bool CanBeHit()
    {
        if (base.CanBeHit())
        {
            enemyStateMachine.ChangeState(skeletonHitState);
            return true;
        }
        return false;
    }
    public override void Damage()
    {
        base.Damage();
        if (!stat.isMagicDamage)
            enemyStateMachine.ChangeState(skeletonHitState);
        CloseCounterAttackWindow();
    }
    public override void Die()
    {
        base.Die();
        enemyStateMachine.ChangeState(skeletonDieState);
        itemDrop.RandomDropItem();
    }
}
